package cn.daniellee.plugin.se.runnable;

import cn.daniellee.plugin.se.SurvivalExpert;
import cn.daniellee.plugin.se.core.GemCore;
import org.bukkit.scheduler.BukkitRunnable;

import java.util.Map;

public class GemRunnable extends BukkitRunnable {

    @Override
    public void run() {
        long cooldown = SurvivalExpert.getInstance().getConfig().getInt("setting.cooldown-minutes", 0);
        long now = System.currentTimeMillis();
        for (Map.Entry<String, Long> placed : GemCore.placedBlocks.entrySet()) {
            if (now - placed.getValue() > cooldown) {
                GemCore.placedBlocks.remove(placed.getKey());
            }
        }
    }

}
